#define _CRT_SECURE_NO_WARNINGS 1
void reserve(int* nums, int begin, int end)
{
    int tmp;
    while (begin < end)
    {
        tmp = nums[begin];
        nums[begin] = nums[end];
        nums[end] = tmp;
        begin++;
        end--;
    }
}
void rotate(int* nums, int numsSize, int k) {
    k %= numsSize;
    reserve(nums, 0, numsSize - 1);
    reserve(nums, 0, k - 1);
    reserve(nums, k, numsSize - 1);

}